﻿@model IEnumerable<Uco.Models.Contact>
@using Telerik.Web.Mvc.UI

@{
    ViewBag.Title = @Html.R("Contacts");
    Layout = "~/Areas/Admin/Views/Shared/_LayoutNoTree.cshtml";
}

<h2>@Html.R("Contacts")</h2>

@(Html.Telerik().Grid(Model)
        .Name("Grid")
        .DataKeys(keys =>
        {
            keys.Add(r => r.ID);
        })
        .DataBinding(dataBinding =>
        {
        dataBinding.Ajax()
            .Select("_AjaxIndex", "Contact")
            .Delete("_AjaxDelete", "Contact");
        })
        .Columns(columns =>
        {
            columns.Bound(r => r.ContactDate).Width(200);
            columns.Bound(r => r.ContactName);
            columns.Bound(r => r.ContactEmail);
            columns.Bound(r => r.ContactPhone);
            columns.Command(commands =>
            {
                commands.Custom("Details").Text(@Html.R("Details")).DataRouteValues(route => route.Add(r => r.ID).RouteKey("ID")).Action("Details", "Contact");
                commands.Delete();
            }).Width(210).Title(@Html.R("Commands"));
        })
        .Pageable()
        .Sortable()
        .Filterable()
        .Groupable()
        .ToolBar(commands => commands.Custom().Text(@Html.R("ExportToCSV")).Action("CSVExport", "Contact"))
)